package com.cxh.rmsq.ui.adapter.self

import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import android.text.Spannable
import android.text.SpannableString
import android.text.style.ForegroundColorSpan
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cxh.rmsq.R
import com.cxh.rmsq.db.model.ClueItemBean
import com.cxh.rmsq.ui.activity.self.LookUserDetailActivity2
import com.cxh.rmsq.ui.widget.GradientTextView
import com.cxh.rmsq.ui.widget.SelectableRoundedImageView
import com.cxh.rmsq.utils.loadImage


/**
 *
 */
class ClueSmallListAdapter(type: Int) :
    BaseQuickAdapter<ClueItemBean, BaseViewHolder>(R.layout.item_clue_small_list),
    LoadMoreModule {

    init {
        addChildClickViewIds(R.id.tv_get)
    }

    var type = type  //2 中  3 高级价格  1初级
    private var mData = mutableListOf<String>() //图片

    @SuppressLint("ResourceType")
    override fun convert(holder: BaseViewHolder, item: ClueItemBean) {
        with(holder) {
            //clueContent 1 文字 2 公里数
            if (item.isOwned) {
                holder.getView<TextView>(R.id.tv_get).isVisible = false
                if (item.clueType == 2) {//公里数
                    setText(
                        R.id.tv_content,
                        (holder.layoutPosition + 1).toString() + "." + item.clueContent + "公里  （点击查看地图）"
                    )
                } else {
                    setText(
                        R.id.tv_content,
                        (holder.layoutPosition + 1).toString() + "." + item.clueContent
                    )
                }
            } else {
                holder.getView<TextView>(R.id.tv_get).isVisible = true
                setText(
                    R.id.tv_content, (holder.layoutPosition + 1).toString() + ".未获取"
                )
            }
        }

    }

}